<?php



/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Game
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
class Game_Model_Category extends Radcodes_Model_Category
{

  const TYPE_ACTION = 'Action';
  const TYPE_ADVENTURE = 'Adventure';
  const TYPE_BOARDGAME = 'Board Game';
  const TYPE_CASINO = 'Casino';
  const TYPE_CUSTOMIZE = 'Customize';
  const TYPE_DRESSUP = 'Dress Up';
  const TYPE_DRIVING = 'Driving';
  const TYPE_EDUCATION = 'Education';
  const TYPE_FIGHTING = 'Fighting';
  const TYPE_JIGSAW = 'Jigsaw';
  const TYPE_LIFESTYLE = 'Life Style';
  const TYPE_MULTIPLAYER = 'Multiplayer';
  const TYPE_OTHER = 'Other';
  const TYPE_PUZZLES = 'Puzzles';
  const TYPE_RHYTHM = 'Rhythm';
  const TYPE_SHOOTING = 'Shooting';
  const TYPE_SOCIAL = 'Social';
  const TYPE_SPORTS = 'Sports';
  const TYPE_STRATEGY = 'Strategy';
  
  const TYPE_UNCATEGORIZED = 'Uncategorized';
  
  /**
$refl = new ReflectionClass('Profile');
print_r($refl->getConstants());
   */
  
  public static function getDistributorCategories()
  {
    static $categories;
    
    if (null === $categories)
    {
      $refl = new ReflectionClass('Game_Model_Category');
      $constants = $refl->getConstants();
      
      $categories = array();
      foreach ($constants as $key => $value) {
        if (strpos($key, 'TYPE_') !== 0) {
          unset($constants[$key]);
        }
        else {
          $categories[strtolower(str_replace("TYPE_", "", $key))] = $value;
        }
      }
    }
    return $categories;
  }
  
  public static function getDistributorCategoryKey($name)
  {
    $categories = array_flip(self::getDistributorCategories());
    return isset($categories[$name]) ? $categories[$name] : null;
  }
  
  public static function getCsvCategories()
  {
    $categories = array(
      '1' => self::TYPE_ACTION,
      '2' => self::TYPE_ADVENTURE,
      '3' => self::TYPE_BOARDGAME,
      '4' => self::TYPE_CASINO,
      '5' => self::TYPE_CUSTOMIZE,
      '6' => self::TYPE_DRESSUP,
      '7' => self::TYPE_DRIVING,
      '8' => self::TYPE_EDUCATION,
      '9' => self::TYPE_FIGHTING,
      '10' => self::TYPE_JIGSAW,
      '11' => self::TYPE_LIFESTYLE,
      '12' => self::TYPE_MULTIPLAYER,
      '13' => self::TYPE_OTHER,
      '14' => self::TYPE_PUZZLES,
      '15' => self::TYPE_RHYTHM,
      '16' => self::TYPE_SHOOTING,
      '17' => self::TYPE_SOCIAL,
      '18' => self::TYPE_SPORTS,
      '19' => self::TYPE_STRATEGY
    );
    return $categories;    
  }
} 

